import torch
import house_price as hp
import pandas as pd
from torch import nn
import train_func as tf
train_features,test_features,train_labels,test_data = hp.load_data() 
num_epochs = 100
learning_rate = 5
weight_decay = 0
batch_size = 64
in_features = train_features.shape[1]
net = nn.Sequential(nn.Linear(in_features,1))
def train_and_predict(test_data):
    tf.train(net,train_features,train_labels,None,None,
             num_epochs,learning_rate,weight_decay,batch_size)
    preds = net(test_features).detach().numpy()
    test_data['SalePrice'] = pd.Series(preds.reshape(1,-1)[0])
    submission = pd.concat([test_data['Id'],test_data['SalePrice']],axis=1)
    submission.to_csv('DL\\HousePrice\\sub\\submission.csv',index=False)

train_and_predict(test_data)
